module.exports = function($scope, $modal, $resource, toaster){

    //查询机构列表
    $scope.search = function(pageNo){
        var para = {
			'pageNo': pageNo,
			'pageSize': $scope.itemsPerPage,
			'acname': $scope.fromData.acname
        }
        $resource('/api/as/ggc/volaccount/getForCompanyList', {}, {}).save(para, function (res) {
            if (res.errcode === 0){
                $scope.activity_list = res.data.results;
                $scope.totalItems = res.data.totalRecord;
                $scope.currentPage = pageNo;
                $scope.fromData.loading = false;
            } else {
                toaster.error({title: '', body: '查询活动列表失败, 请刷新页面'});
            }
        });
    }

    init();
    //初始化页面信息
    function init(){
        $scope.fromData = {
            'loading': true,
        };
        $scope.currentPage = 1;			//当前页码
		$scope.itemsPerPage = 10;		//每页显示几条
        $scope.search(1);
    }

    //公司内每个活动管理
    $scope.setting = function(activity, info) {
        var modalInstance = $modal.open({
			template: require('../views/apartSaleSetInfo.html'),
			controller: 'apartSaleSetInfo',
			size: 'lg',
			resolve: {
				activity: function () {
					return activity;
                },
                info: function () {
					return info;
				}
			}
		});
    }


};